<? require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); ?>

<?
if (!CModule::IncludeModule("iblock"))
{
    echo "Не установлен модуль Информационных-блоков";
    die();
}

// функции для работы с MSSQL
class DBase
{
    var $host;
    var $username;
    var $password;
    var $bsname;

    var $result;
    var $num_rows;
    var $num_cols;
    var $row;

    function DBase($dbhost,$dbusername,$dbpassword,$dbbasename)
    {
            $this->host = $dbhost;
            $this->username = $dbusername;
            $this->password = $dbpassword;
            $this->bsname = $dbbasename;
            mssql_connect($this->host,$this->username,$this->password) or
                    die( "Нельзя подключиться к базе данных" );
            mssql_select_db($this->bsname);

    }

    function sql($sql)
    {
            return mssql_query($sql) or die ( "Неверный запрос: $sql<br>" );
    }

    function select($sql)
    {
            $this->result = mssql_query($sql) or die ( "Неверный запрос: $sql<br>" );
            $this->num_rows = mssql_num_rows($this->result);
            $this->row = 0;
            $this->num_cols = mssql_num_fields($this->result);
            return mssql_fetch_object($this->result);
    }

    function next()
    {
            $this->row++;
            return mssql_fetch_object($this->result);
    }

    function numrows()
    {
            return $this->num_rows;
    }

    function numcols()
    {
            return $this->num_cols;
    }

    function eof()
    {
            return $this->row == $this->num_rows;
    }

    function fields()
    {
            $i = 0;
            while ( $i < $this->num_cols )
            {
                    $arr[$i][0] = mssql_field_name($this->result,$i);
                    $arr[$i][1] = mssql_field_type($this->result,$i);
                    $arr[$i][2] = mssql_field_len($this->result,$i);
                    $arr[$i][3] = mssql_field_flags($this->result,$i);
                    $i++;
            }
            return $arr;
    }

    function close()
    {
            if ($this->result != null) mssql_free_result($this->result);
            mssql_close();
    }
}    

function Encode($str)
{
    static $table = array(
    "\xA8" => "\xD0\x81",
    "\xB8" => "\xD1\x91",
    "\xA1" => "\xD0\x8E",
    "\xA2" => "\xD1\x9E",
    "\xAA" => "\xD0\x84",
    "\xAF" => "\xD0\x87",
    "\xB2" => "\xD0\x86",
    "\xB3" => "\xD1\x96",
    "\xBA" => "\xD1\x94",
    "\xBF" => "\xD1\x97",
    "\x8C" => "\xD3\x90",
    "\x8D" => "\xD3\x96",
    "\x8E" => "\xD2\xAA",
    "\x8F" => "\xD3\xB2",
    "\x9C" => "\xD3\x91",
    "\x9D" => "\xD3\x97",
    "\x9E" => "\xD2\xAB",
    "\x9F" => "\xD3\xB3",
    );
    return preg_replace('#[\x80-\xFF]#se',
    ' "$0" >= "\xF0" ? "\xD1".chr(ord("$0")-0x70) :
                       ("$0" >= "\xC0" ? "\xD0".chr(ord("$0")-0x30) :
                        (isset($table["$0"]) ? $table["$0"] : "")
                       )',
    $str
    );
}

function GetUserPhoto($userid)
{
    $imgPath = "http://10.15.140.3/UserPhotos/".$userid.".jpg";
    if (!file_get_contents($imgPath))
    {
       $rsUser = CUser::GetByLogin($userid);
       if($arUser = $rsUser->Fetch())
       {
           if ($arUser["PERSONAL_PHOTO"]>0)
           {
               $arFile = CFile::GetFileArray($arUser["PERSONAL_PHOTO"]);
               $imgPath = $arFile["SRC"];
           }
           else
               $imgPath = "/bitrix/images/socialnetwork/nopic_user_150.gif";
       }
       else
           $imgPath = "/bitrix/images/socialnetwork/nopic_user_150.gif";                    
    }
    return $imgPath;
}

function GetPersonDivWidth($cnt)
{
    if ($cnt <= 3)
        return "w500";
    elseif ($cnt == 4)
        return "w375";
    elseif ($cnt <= 10)
        return "w250";
    elseif ($cnt <= 12)
        return "w225";
    elseif ($cnt <= 14)
        return "w200";
    elseif ($cnt <= 16)
        return "w175";
    else
        return "w150";    
}


$host = "10.15.140.3";
$username = "sa";
$password = "admin";
$dbname = "PayDox";
$dbase = new DBase($host,$username,$password,$dbname);

// ***********************************
// выбираем предустановленные значения
// ***********************************
$showNewsRosAtom = false;
$showTraffic = false;
$showBirthdays = false;
$showBusinessTrip = false;
$showStudies = false;
$showVacation = false;
$showStaff = false;
$showOther = false;

$currdate = date("d.m.Y");

// новости с сайта Росатома
$item = GetIBlockElement(2862); 
if ($item["ACTIVE"]=="Y")
{
    $infoNewsRosAtom["NAME"] = $item["NAME"];
    $infoNewsRosAtom["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];
    $showNewsRosAtom = true;
}

// пробки и погода
$item = GetIBlockElement(2863); 
if ($item["ACTIVE"]=="Y")
{
    $infoTraffic["NAME"] = $item["NAME"];
    $infoTraffic["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];    
//    $showTraffic = true;
}

// дни рождения    
$item = GetIBlockElement(2864); 
if ($item["ACTIVE"]=="Y")
{   
    $infoBirthdays["NAME"] = $item["NAME"];
    $infoBirthdays["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];                
//    $showBirthdays = true;
}

if ($showBirthdays)
{   
    $sql = "SET DATEFIRST 1; SELECT UserID, Name, BirthDate, DATEPART(day, BirthDate) as BirthDay, DATEPART(day, GETDATE()) as CurrDay FROM Users WHERE BirthDate is not null AND StatusActive='1' AND DateExpirationSecurity>=GETDATE() and DATEPART(month, BirthDate)=DATEPART(month, GetDate()) AND DATEPART(day, BirthDate)>=DATEPART(day, GETDATE()) AND DATEPART(day, BirthDate)<=(DATEPART(day, GETDATE())+7-DATEPART(weekday, GETDATE())) ORDER BY DATEPART(month, BirthDate) ASC, DATEPART(day, BirthDate)";
    $rec = $dbase->select( $sql );
    $num = $dbase->numrows();
    if ($num)
    {
        $showBirthdays = true;
        $usersBirthday = array();
        $currday = date("d");
        for ( $n = 0; $n < $num; $n++ )
        {
            $user = array();
            $user["USERID"] = Encode($rec->UserID);
            $user["NAME"] = Encode($rec->Name);
            $user["DATE"] = date("d.m.Y", strtotime($rec->BirthDate));            
            $user["DAY"] = $rec->BirthDay;
            $user["D"] = $rec->BirthDay.".".date("m.Y");
            $user["DAYOFWEEK"] = date("w", strtotime($user["D"]));
            $user["imgPath"] = GetUserPhoto($user["USERID"]);
            if ($user["DAY"]==$currday)
                $usersBirthday["TODAY"][] = $user;
            else
                $usersBirthday["WEEK"][] = $user;
            unset($user);
            $rec = $dbase->next();
        }
    }
    else
        $showBirthdays = false;
}   
    
// командировки
$item = GetIBlockElement(2865); 
if ($item["ACTIVE"]=="Y")
{
    $infoBusinessTrip["NAME"] = $item["NAME"];
    $infoBusinessTrip["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];                
//    $showBusinessTrip = true;
}

if ($showBusinessTrip)
{   
    $item["PREVIEW_TEXT"] = str_replace(array("\r", "\n", "<br>", "<br />"), "", $item["PREVIEW_TEXT"]);
    $in_str = "";
    $usersndate = explode(";", $item["PREVIEW_TEXT"]); // выбираем все записи вида логин:дата1,дата2,...,датаN
    $n = 0;
    foreach($usersndate as $item)
    {       
        list($user,$dates) = explode(":", $item);
        if (strpos($dates,$currdate)!==FALSE) // если текущая дата есть в списке дат сотрудника, то выводим информацию о нем
        {
            if ($n++)
                $in_str .= ",";
            $in_str .= "'".trim($user)."'";
        }
    }
    if (strlen($in_str))
    {
        $sql = "SELECT UserID, Name FROM Users WHERE StatusActive='1' AND DateExpirationSecurity>=GETDATE() AND UserID IN (".$in_str.") ORDER BY Name";
        $rec = $dbase->select( $sql );
        $num = $dbase->numrows();
        if ($num)
        {
            $showBusinessTrip = true;
            $usersBusinessTrip = array();
            for ( $n = 0; $n < $num; $n++ )
            {
                $user = array();
                $user["USERID"] = Encode($rec->UserID);
                $user["NAME"] = Encode($rec->Name);
                $user["imgPath"] = GetUserPhoto($user["USERID"]);
                $usersBusinessTrip[] = $user;
                unset($user);
                $rec = $dbase->next();
            }
        }
        else
            $showBusinessTrip = false;
    }
    else
        $showBusinessTrip = false;
} 

// учеба
$item = GetIBlockElement(2866); 
if ($item["ACTIVE"]=="Y")
{
    $infoStudies["NAME"] = $item["NAME"];
    $infoStudies["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];                
//    $showStudies = true;
}

if ($showStudies)
{   
    $item["PREVIEW_TEXT"] = str_replace(array("\r", "\n", "<br>", "<br />"), "", $item["PREVIEW_TEXT"]);
    $in_str = "";
    $usersndate = explode(";", $item["PREVIEW_TEXT"]); // выбираем все записи вида логин:дата1,дата2,...,датаN
    $n = 0;
    foreach($usersndate as $item)
    {       
        list($user,$dates) = explode(":", $item);
        if (strpos($dates,$currdate)!==FALSE) // если текущая дата есть в списке дат сотрудника, то выводим информацию о нем
        {
            if ($n++)
                $in_str .= ",";
            $in_str .= "'".trim($user)."'";
        }
    }   
    if (strlen($in_str))
    {
        $sql = "SELECT UserID, Name FROM Users WHERE StatusActive='1' AND DateExpirationSecurity>=GETDATE() AND UserID IN (".$in_str.") ORDER BY Name";
        $rec = $dbase->select( $sql );
        $num = $dbase->numrows();
        if ($num)
        {
            $showStudies = true;
            $usersStudies = array();
            for ( $n = 0; $n < $num; $n++ )
            {
                $user = array();
                $user["USERID"] = Encode($rec->UserID);
                $user["NAME"] = Encode($rec->Name);
                $user["imgPath"] = GetUserPhoto($user["USERID"]);
                $usersStudies[] = $user;
                unset($user);
                $rec = $dbase->next();
            }
        }
        else
            $showStudies = false;
    }
    else
        $showStudies = false;
}

// отпуска
$item = GetIBlockElement(3383); 
if ($item["ACTIVE"]=="Y")
{
    $infoVacation["NAME"] = $item["NAME"];
    $infoVacation["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];                
//    $showVacation = true;
}

if ($showVacation)
{   
    $item["PREVIEW_TEXT"] = str_replace(array("\r", "\n", "<br>", "<br />"), "", $item["PREVIEW_TEXT"]);
    $in_str = "";
    $usersndate = explode(";", $item["PREVIEW_TEXT"]); // выбираем все записи вида логин:дата1,дата2,...,датаN
    $n = 0;
    foreach($usersndate as $item)
    {       
        list($user,$dates) = explode(":", $item);
        if (strpos($dates,$currdate)!==FALSE) // если текущая дата есть в списке дат сотрудника, то выводим информацию о нем
        {
            if ($n++)
                $in_str .= ",";
            $in_str .= "'".trim($user)."'";
        }
    }   
    if (strlen($in_str))
    {
        $sql = "SELECT UserID, Name FROM Users WHERE StatusActive='1' AND DateExpirationSecurity>=GETDATE() AND UserID IN (".$in_str.") ORDER BY Name";
        $rec = $dbase->select( $sql );
        $num = $dbase->numrows();
        if ($num)
        {
            $showVacation = true;
            $usersVacation = array();
            for ( $n = 0; $n < $num; $n++ )
            {
                $user = array();
                $user["USERID"] = Encode($rec->UserID);
                $user["NAME"] = Encode($rec->Name);
                $user["imgPath"] = GetUserPhoto($user["USERID"]);
                $usersVacation[] = $user;
                unset($user);
                $rec = $dbase->next();
            }
        }
        else
            $showVacation = false;
    }
    else
        $showVacation = false;
}

// кадровые перестановки
$item = GetIBlockElement(3387); 
if ($item["ACTIVE"]=="Y")
{
    $infoStaff["NAME"] = $item["NAME"];
    $infoStaff["INTERVAL"] = $item["PROPERTIES"]["INTERVAL"]["VALUE"];                
//    $showStaff = true;
}

if ($showStaff)
{   
    $item["PREVIEW_TEXT"] = str_replace(array("\r", "\n", "<br>", "<br />"), "", $item["PREVIEW_TEXT"]);
    $in_str = "";
    $usersntext = explode(";", $item["PREVIEW_TEXT"]); // выбираем все записи вида логин:событие
    $n = 0;
    $tempStaff = array();
    foreach($usersntext as $item)
    {       
        list($user,$text) = explode(":", $item);
        $tempStaff[$user] = $text;
        if ($n++)
            $in_str .= ",";
        $in_str .= "'".trim($user)."'";
    }   
    if (strlen($in_str))
    {
        $sql = "SELECT UserID, Name FROM Users WHERE UserID IN (".$in_str.") ORDER BY Name";
        $rec = $dbase->select( $sql );
        $num = $dbase->numrows();
        if ($num)
        {
            $showStaff = true;
            $usersStaff = array();
            for ( $n = 0; $n < $num; $n++ )
            {
                $user = array();
                $user["USERID"] = Encode($rec->UserID);
                $user["NAME"] = Encode($rec->Name);
                $user["TEXT"] = $tempStaff[$user["USERID"]];
                $user["imgPath"] = GetUserPhoto($user["USERID"]);
                $usersStaff[] = $user;
                unset($user);
                $rec = $dbase->next();
            }
        }
        else
            $showStaff = false;
    }
    else
        $showStaff = false;
}

// выбираем все остальное
$items = CIBlockElement::GetList(Array("SORT"=>"ASC"), Array("IBLOCK_ID"=>"1", "ACTIVE"=>"Y", "ACTIVE_DATE"=>"Y", "!ID"=>Array("2862", "2863", "2864", "2865", "2866", "3383", "3387")), false, false, Array("ID", "NAME", "PREVIEW_PICTURE", "DETAIL_PICTURE", "PREVIEW_TEXT", "PROPERTY_INTERVAL"));
while ($item = $items->GetNext())
{
    if ($item["PREVIEW_PICTURE"])
        $item["PREVIEW_PICTURE"] = CFile::GetFileArray($item["PREVIEW_PICTURE"]);
    if ($item["DETAIL_PICTURE"])
        $item["DETAIL_PICTURE"] = CFile::GetFileArray($item["DETAIL_PICTURE"]);
    
    $item["INTERVAL"] = $item["PROPERTY_INTERVAL_VALUE"];
    
    $info[] = $item;
}
if (count($info))
    $showOther = true;


?>


<div id="slider_box">
    <div id='slider_left_box'>
        <div id="carousel2" class="jcarousel-skin-tango-2">
                <div class="jcarousel" id="jcarousel2">
                        <ul>
                            <? if ($showNewsRosAtom): ?>
                            <li interval='<?= $infoNewsRosAtom["INTERVAL"]; ?>'>
                                <h2><?= $infoNewsRosAtom["NAME"]; ?></h2>
                                <?$APPLICATION->IncludeComponent(
                                        "bitrix:rss.show",
                                        "",
                                        Array(
                                                "SITE" => "www.rosatom.ru",
                                                "PORT" => "80",
                                                "PATH" => "/journalist/news/newsRSS.xml",
                                                "QUERY_STR" => "",
                                                "OUT_CHANNEL" => "N",
                                                "NUM_NEWS" => "3",
                                                "CACHE_TYPE" => "N",
                                                "CACHE_TIME" => "3600"
                                        )
                                );?>
                            </li>
                            <? endif; ?>
                            <? if ($showTraffic): ?>
                            <li interval='<?= $infoTraffic["INTERVAL"]; ?>'>
                                <h2><?= $infoTraffic["NAME"]; ?></h2>
                                <div class="yandex_maps">
                                    <script src="http://api-maps.yandex.ru/2.1-dev/?lang=ru-RU&load=package.full" type="text/javascript"></script>
                                    <div id="ymap" style="width: 1060px; height: 800px"></div>
                                    <script type="text/javascript">
                                        ymaps.ready(function () {
                                            var myMap = new ymaps.Map('ymap', {
                                                center: [55.73, 37.64],
                                                zoom: 10,
                                                controls: []
                                            });
                                            
                                            var trafficControl = new ymaps.control.TrafficControl({state: {trafficShown: true}});
                                            myMap.controls.add(trafficControl, {top: 10, left: 10});
                                            
                                            function updateProvider () {
                                                 trafficControl.getProvider('traffic#actual').update();  
                                            }
                                            // Будем слать запрос на обновление данных каждые 4 минуты.
                                            window.setInterval(updateProvider, 4 * 60 * 1000);
                                        });  
                                    </script>                                
                                </div>
                                <div class="foreca">
                                <? 
                                require ($_SERVER["DOCUMENT_ROOT"].'/plazma/phpQuery-onefile.php');
                                $month = array("", "января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря");
                                $foreca = file_get_contents('http://www.foreca.ru/Russia/Moskva?tenday');
                                $document = phpQuery::newDocument($foreca);
                                $hentry = $document->find('div.c1');
                                $n = 0;
                                foreach ($hentry as $el) 
                                {
                                    $pq = pq($el);
                                    $pq->find('a.cell span.more')->remove();
                                    $pq->find('a.cell span span')->remove();
                                    $date_el = $pq->find('a.cell span.h5');
                                    $date = $date_el->html();
                                    $arr = explode(" ", $date);
                                    if (strlen($arr[1]))
                                    {
                                        $arrdate = explode(".", $arr[1]);  
                                        $newdate = $arr[0].", ".$arrdate[0]." ".$month[$arrdate[1]];
                                        $date_el->html($newdate);
                                    }                                    
                                    echo "<div class='weather'>";
                                    $weather = $pq->find('a.cell')->html();
                                    $weather = str_replace("<span></span>", "", $weather);
                                    $weather = str_replace("><br>", ">", $weather);
                                    $weather = str_replace("src=\"/img/", "src=\"http://www.foreca.ru/img/", $weather);
                                    $weather = str_replace("пн,", "Понедельник,", $weather);
                                    $weather = str_replace("вт,", "Вторник,", $weather);
                                    $weather = str_replace("ср,", "Среда,", $weather);
                                    $weather = str_replace("чт,", "Четверг,", $weather);
                                    $weather = str_replace("пт,", "Пятница,", $weather);
                                    $weather = str_replace("сб,", "Суббота,", $weather);
                                    $weather = str_replace("вс,", "Воскресенье,", $weather);
                                    echo $weather;
                                    echo "</div><div class='spacer h20'></div>";
                                    if (++$n == 8)
                                        break;
                                }
                                ?>
                                </div>
                            </li>
                            <? endif; ?>

                            <? if ($showBirthdays): ?>
                            <? $dayOfWeek = array("В воскресенье", "В понедельник", "Во вторник", "В среду", "В четверг", "В пятницу", "В субботу"); ?>
                            <li interval='<?= $infoBirthdays["INTERVAL"]; ?>'>
                                <h2><?= $infoBirthdays["NAME"]; ?></h2>
                                <div class="birthday">
                                    <?
                                    $cl = "w225";
                                    if (count($usersBirthday["TODAY"]))
                                    {
                                        foreach ($usersBirthday["TODAY"] as $user)
                                        {
                                            echo "<div class=\"polaroid w350\">";
                                            echo "<p class='date'>".$dayOfWeek[$user["DAYOFWEEK"]]."</p>";
                                            echo "<img src=\"".$user["imgPath"]."\" height=\"150px;\" />";
                                            echo "<p class='name'>".$user["NAME"]."</p>";
                                            echo "</div>";                                        
                                        }
                                        echo "<div class='spacer'></div>";
                                        $cl = "w150";
                                    }
                                    ?>
                                    <?
                                    foreach ($usersBirthday["WEEK"] as $user)
                                    {
                                        echo "<div class=\"polaroid ".$cl."\">";
                                        echo "<p class='date'>".$dayOfWeek[$user["DAYOFWEEK"]]."</p>";
                                        echo "<img src=\"".$user["imgPath"]."\" height=\"150px;\" />";
                                        echo "<p class='name'>".$user["NAME"]."</p>";
                                        echo "</div>";
                                    }
                                    ?>                                    
                                </div>
                                <div style="text-align: center;padding-top: 100px;font-weight: bold;color: red;font-size: 20px;">Коллеги! Просьба прислать ваши актуальные фотографии на адрес <u>druzhinin@vniiaes-asutp.ru</u></div>
                            </li>
                            <? endif; ?>               

                            <? if ($showVacation): ?>
                            <li interval='<?= $infoVacation["INTERVAL"]; ?>'>
                                <h2><?= $infoVacation["NAME"]; ?></h2>
                                <div class="persons">                                
                                    <?
                                    $cl = GetPersonDivWidth(count($usersVacation));
                                    
                                    foreach ($usersVacation as $user)
                                    {                           
                                        echo "<div class=\"polaroid ".$cl."\">";
                                        echo "<img src=\"".$user["imgPath"]."\" height=\"150px;\" />";
                                        echo "<p>".$user["NAME"]."</p>";
                                        echo "</div>";
                                    }
                                    ?>
                                </div>
                                <div style="text-align: center;padding-top: 100px;font-weight: bold;color: red;font-size: 20px;">Коллеги! Просьба прислать ваши актуальные фотографии на адрес <u>druzhinin@vniiaes-asutp.ru</u></div>
                            </li>
                            <? endif; ?>
                                                       
                            <? if ($showBusinessTrip): ?>
                            <li interval='<?= $infoBusinessTrip["INTERVAL"]; ?>'>
                                <h2><?= $infoBusinessTrip["NAME"]; ?></h2>
                                <div class="persons">                                
                                    <?
                                    $cl = GetPersonDivWidth(count($usersBusinessTrip));
                                    
                                    foreach ($usersBusinessTrip as $user)
                                    {                           
                                        echo "<div class=\"polaroid ".$cl."\">";
                                        echo "<img src=\"".$user["imgPath"]."\" />";
                                        echo "<p>".$user["NAME"]."</p>";
                                        echo "</div>";
                                    }
                                    ?>
                                </div>
                                <div style="text-align: center;padding-top: 100px;font-weight: bold;color: red;font-size: 20px;">Коллеги! Просьба прислать ваши актуальные фотографии на адрес <u>druzhinin@vniiaes-asutp.ru</u></div>
                            </li>
                            <? endif; ?>
                            
                            <? if ($showStudies): ?>
                            <li interval='<?= $infoStudies["INTERVAL"]; ?>'>
                                <h2><?= $infoStudies["NAME"]; ?></h2>
                                <div class="persons">                                
                                    <?
                                    $cl = GetPersonDivWidth(count($usersStudies));
                                    
                                    foreach ($usersStudies as $user)
                                    {                                       
                                        echo "<div class=\"polaroid  ".$cl."\">";
                                        echo "<img src=\"".$user["imgPath"]."\" height=\"150px;\" />";
                                        echo "<p>".$user["NAME"]."</p>";
                                        echo "</div>";
                                    }
                                    ?>
                                </div>
                                <div style="text-align: center;padding-top: 100px;font-weight: bold;color: red;font-size: 20px;">Коллеги! Просьба прислать ваши актуальные фотографии на адрес <u>druzhinin@vniiaes-asutp.ru</u></div>
                            </li>
                            <? endif; ?>
                            
                            <? if ($showStaff): ?>
                            <li interval='<?= $infoStaff["INTERVAL"]; ?>'>
                                <h2><?= $infoStaff["NAME"]; ?></h2>
                                <div class="birthday">                                
                                    <?
                                    $cl = GetPersonDivWidth(count($usersStaff));
                                    
                                    foreach ($usersStaff as $user)
                                    {                                       
                                        echo "<div class=\"polaroid ".$cl."\">";
                                        echo "<p class='date'>".$user["TEXT"]."</p>";
                                        echo "<img src=\"".$user["imgPath"]."\" height=\"150px;\" />";
                                        echo "<p class='name'>".$user["NAME"]."</p>";
                                        echo "</div>";
                                    }
                                    ?>                                    
                                </div>
                                <div style="text-align: center;padding-top: 100px;font-weight: bold;color: red;font-size: 20px;">Коллеги! Просьба прислать ваши актуальные фотографии на адрес <u>druzhinin@vniiaes-asutp.ru</u></div>
                            </li>
                            <? endif; ?>

                            <? if ($showOther): ?>
                            <? foreach ($info as $el): ?>
                            <li interval='<?= $el["INTERVAL"]; ?>'>
                                <h2><?= $el["NAME"]; ?></h2>
                                
                                <? if (strlen($el["DETAIL_PICTURE"]["SRC"])): ?>
                                <div class="info_img">
                                    <img src='<?= $el["DETAIL_PICTURE"]["SRC"]; ?>' />
                                <? else: ?>
                                <div class="info">
                                    <? if (strlen($el["PREVIEW_PICTURE"]["SRC"])): ?>
                                        <img src='<?= $el["PREVIEW_PICTURE"]["SRC"]; ?>' />
                                    <? endif; ?>
                                    <?= $el["PREVIEW_TEXT"]; ?>
                                <? endif; ?>
                                </div>
                            </li>
                            <? endforeach; ?>
                            <? endif; ?>
                            
                        </ul>
                </div>
                <div class="jcarousel-pagination" id="jcarousel-pagination"></div>
        </div>
    </div>
</div>    

<div class="countdown"></div>
<div id="hours">
    <script language="JavaScript" type="text/javascript" src="/plazma/date.js"></script>
</div>
    
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
